Skip to content

Conversation

@depau
Copy link

@depau depau commented Jun 19, 2025

The header comment says:

/**
* Either:
* * {@link GCodeFlavour} - one or more G-code flavours to which the aciton applies (or'd together), regardless of generator or dialect version.
* * `[flavour: `{@link GCodeFlavour}`, semVerRange: string]` - a (single) G-code flavour and the generator or dialect version range to which
* the action applies. If `flavour` is {@link GCodeFlavour.RatOS}, then then {@link GCodeInfo.ratosDialectVersion} is compared, otherwise
* {@link GCodeInfo.generatorVersion} is compared.
*/

However there must be an oversight since generatorVersion is being compared anyway. This fixes it.


By the way, are there any specs on what exactly qualifies as "RatOS dialect"?

Summary by CodeRabbit

  • Bug Fixes
    • Corrected version validation for RatOS G-code flavour to ensure accurate detection and error reporting for unsupported dialect versions.

Copilot AI review requested due to automatic review settings June 19, 2025 20:10
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 19, 2025

Walkthrough

The validation logic for RatOS G-code flavour in the Actions module was updated to check the ratosDialectVersion property instead of generatorVersion. The corresponding error message was also revised to reference the correct property. No changes were made to exported or public entity declarations.

Changes

File(s) Change Summary
src/server/gcode-processor/Actions.ts Updated version validation logic to use ratosDialectVersion and revised error messaging.

Poem

A bunny checks the dialect, not the version in disguise,
With careful paws it updates, and clarifies the whys.
Now RatOS speaks clearly, no confusion in the air—
The G-code flows smoothly, with validation fair!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 420f1a7 and 5c86cfb.

📒 Files selected for processing (1)
  • src/server/gcode-processor/Actions.ts (1 hunks)
🔇 Additional comments (1)
src/server/gcode-processor/Actions.ts (1)

123-125: LGTM! Bug fix correctly implements documented behavior.

The change properly aligns the implementation with the documented behavior described in lines 50-56. The code now correctly uses ratosDialectVersion for RatOS flavour validation instead of generatorVersion, and the error message has been updated accordingly.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an oversight in the version check for the RatOS dialect by comparing against the correct property.

  • Fixes the version comparison to use ratosDialectVersion instead of generatorVersion.
  • Updates the error message to reflect the correct version field.
Comments suppressed due to low confidence (2)

src/server/gcode-processor/Actions.ts:123

  • The version check now uses ratosDialectVersion as intended, but please confirm that all related references and documentation align with this change.
				if (semver.neq('0.1', gcodeInfo.ratosDialectVersion)) {

src/server/gcode-processor/Actions.ts:125

  • Ensure that the updated error message accurately communicates that the check is for the RatOS dialect version and that any associated documentation is updated accordingly.
						`Only version 0.1 of the RatOS G-code dialect is supported. Version ${gcodeInfo.ratosDialectVersion} is not supported.`,

depau added a commit to depau-forks/Pressure_Linear_Advance_Tool that referenced this pull request Jun 19, 2025
Note that due to Rat-OS/RatOS-configurator#91 the tool version needs to be
set to 0.1, otherwise RatOS will refuse to print the G-Code unless the user
overrides it in their Klipper config (unlikely to do so since it's undocumented)
@tg73
Copy link
Collaborator

tg73 commented Jun 19, 2025

@depau

By the way, are there any specs on what exactly qualifies as "RatOS dialect"?

No, it hasn't been defined yet. When writing the new postprocessor, I added it as a concept to support custom GCode generators, for example programmatically-generated gcode (which I do for my own projects). For IDEX prints, it should be easier to emit the post-processed style of Tn commands rather than try to emulate PrusaSlicer. However, I've not yet got to generating IDEX gcode programatically, so I've not got around to defining or properly supporting RatOS dialect gcode.

Anyhow, your change looks good to me, even though no user should be hitting that code path at the moment. Well spotted!

@depau
Copy link
Author

depau commented Jun 19, 2025

@tg73

[...] even though no user should be hitting that code path at the moment. Well spotted!

Thanks!

I spotted this as I'm trying to add support for RatOS to "Ellis' Pressure Advance / Linear Advance Calibration Tool" FYI AndrewEllis93/Pressure_Linear_Advance_Tool#48

I'm still hitting some issues though

depau added a commit to depau-forks/Pressure_Linear_Advance_Tool that referenced this pull request Jun 19, 2025
Note that due to Rat-OS/RatOS-configurator#91 the tool version needs to be
set to 0.1, otherwise RatOS will refuse to print the G-Code unless the user
overrides it in their Klipper config (unlikely to do so since it's undocumented)
@tg73
Copy link
Collaborator

tg73 commented Jun 19, 2025

@depau the established escape hatch for stuff like Ellis gcode is covered here.

tl;dr: run ALLOW_UNKNOWN_GCODE_GENERATOR from the console to allow the next print to be from an unknown generator.

However, this might still be only on the development branch (need to check). But a new release in actively in the works, so it should be available generally soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants